package com.yjd.bi.user.enums;

/**
 * @Description TODO
 * @Author Takioo
 * @Date 2018/9/25 15:02
 **/
public enum LoginChannel {
    NONE(0, "未知"),
    PC(1, "PC"),
    ANDROID(2, "android"),
    IOS(3, "iOS"),
    WEIXIN(4, "微信"),
    WAP(5, "wap"),
    BACK(6, "活动中心发放"),
    BACKMANAGER(7, "后台管理");

    private int code;
    private String label;

    private LoginChannel(int code, String label) {
        this.code = code;
        this.label = label;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String lable) {
        this.label = lable;
    }

    public static LoginChannel getChannel(int code){
        LoginChannel[] channels = LoginChannel.values();
        for(LoginChannel c : channels){
            if(c.getCode()==code){
                return c;
            }
        }
        return LoginChannel.NONE;
    }

}
